﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// ReSharper disable InconsistentNaming

namespace ChanTai.WebApi.Data
{
    /// <summary>
    ///投保人
    /// </summary>
    public class RelatedParty: ApiCovent
    {
        /// <summary>
        /// 默认值初始化
        /// </summary>
        public RelatedParty()
        {
            insuredType = "1";
            uWCount = 1;
            insuredName = "";
            identifyType = "";
            identifyNumber = "";
            insuredAddress = "";
            birthDate = "";
            mobilePhone = "";
            marriageStatus = "";
            Email = "";
            postCode = "";
            contactName = "";
            contactPhone = "";
            contactSex = "";
            contactType = "";
            contactIdentifyType = "";
            contactIdentifyNumber = "";
            corporateKind = "";
            businessSource = "";
        }

        /// <summary>
        /// 投保份数
        /// </summary>
        public int uWCount { get; set; }
        /// <summary>
        /// *投保人类型[1]
        /// </summary>
        public string insuredType { get; set; }
        /// <summary>
        /// *投保名称[50]
        /// </summary>
        public string insuredName { get; set; }

        /// <summary>
        /// *投保人证件类型[2]
        /// </summary>
        public string identifyType { get; set; }

        /// <summary>
        /// *投保人证件号码[30]
        /// </summary>
        public string identifyNumber { get; set; }

        /// <summary>
        /// 投保人地址[200]
        /// </summary>
        public string insuredAddress { get; set; }

        /// <summary>
        /// 出生日期[yyyy-MM-dd]
        /// </summary>
        public string birthDate { get; set; }

        /// <summary>
        /// 手机号码[11]
        /// </summary>
        public string mobilePhone { get; set; }

        /// <summary>
        /// 婚姻状况[2]
        /// </summary>
        public string marriageStatus { get; set; }

        /// <summary>
        /// Email地址[50]
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// 邮政编码[6]
        /// </summary>
        public string postCode { get; set; }

        /// <summary>
        /// 联系人[50]
        /// </summary>
        public string contactName { get; set; }

        /// <summary>
        /// 联系人电话[20]
        /// </summary>
        public string contactPhone { get; set; }

        /// <summary>
        /// 联系人性别[1]
        /// </summary>
        public string contactSex { get; set; }

        /// <summary>
        /// 联系人类型[2]
        /// </summary>
        public string contactType { get; set; }

        /// <summary>
        /// 联系人证件类型[2]
        /// </summary>
        public string contactIdentifyType { get; set; }

        /// <summary>
        /// 联系人证件号码[50]
        /// </summary>
        public string contactIdentifyNumber { get; set; }

        /// <summary>
        /// 单位性质[50]
        /// </summary>
        public string corporateKind { get; set; }

        /// <summary>
        /// 行业[50]
        /// </summary>
        public string businessSource { get; set; }

        /// <summary>
        /// 身份证设置证件信息
        /// </summary>
        /// <param name="idno"></param>
        public void setInsuredIdNo(string idno)
        {
            if(!CheckIdCard(idno)) return;
            identifyNumber = idno;
            birthDate = GetIdNoBirthday(idno);
            identifyType = "01";
        }
        /// <summary>
        /// 身份证设置联系人证件信息
        /// </summary>
        /// <param name="idno"></param>
        public void setContactIdNo(string idno)
        {
            if (!CheckIdCard(idno)) return;
            identifyNumber = idno;
            birthDate = GetIdNoBirthday(idno);
            contactIdentifyType = "01";
            contactSex = GetInNoSex(idno);
        }
    }
}
